<?php 

	$year = isset($_GET['year']) ? $_GET['year'] : date("Y"); //当前的年
	$month = isset($_GET['month']) ? $_GET['month'] : date("m"); //当前的月
	$day = isset($_GET['day']) ? $_GET['day'] : date("d"); //当前的日

	//当年当月的天数
	$days = date("t", mktime(0,0,0, $month, 1, $year));
	//获取当月的第一天是星期几
	$startweek = date("w", mktime(0,0,0, $month, 1, $year));

	/*echo "今天是{$year}年{$month}月{$day}日,是万圣节的第二天<br>";*/

	echo '<table width="300px" align="center" style="background: #DBFCFE; color:#176876;">';
		echo '<tr>';
			echo '<th style="background:#7FEBF6">日</th>';
			echo '<th style="background:#7FEBF6">一</th>';
			echo '<th style="background:#7FEBF6">二</th>';
			echo '<th style="background:#7FEBF6">三</th>';
			echo '<th style="background:#7FEBF6">四</th>';
			echo '<th style="background:#7FEBF6">五</th>';
			echo '<th style="background:#7FEBF6">六</th>';
		echo '</tr>';

		echo '<tr align="center">';
		for ($i=0; $i < $startweek ; $i++) { 

			echo "<td>&nbsp;</td>";
		}
		for ($j=1; $j <$days ; $j++) { 
			# code...
			 $i++;

			if($j == $day){
				echo '<td style="background:#26EDF3">'.$j.'</td>';
			}else{
				echo '<td>'.$j.'</td>';
			}
			if($i%7==0){
				echo '</tr><tr align="center">';
			}
		}
		while ($i%7!==0) {
			echo "<td>&nbsp;</td>";
			$i++;
		}
		echo '</tr>';
	echo '</table>';




 ?>